﻿using System;
using System.Collections.Generic;

using System.Text;

using TerminologiaSinacor.Presenter;
using TerminologiaSinacor.Presenter.Utility;

using System.Data.OracleClient;
using System.Data;
using System.Configuration;

namespace TerminologiaSinacor.Presenter.DAL.Oracle
{
    public class ResponsavelDAO
    {
        public static List<Responsavel> search()
        {
            //string sql = "select COD_RESPONSAVEL,NOME_RESPONSAVEL,TXT_CONTATO_RESPONSAVEL from CORRMAIS.TS_RESPONSAVEL"; //excluido - esertorio - 200809241206
            string sql = "select COD_RESPONSAVEL,NOME_RESPONSAVEL,TXT_CONTATO_RESPONSAVEL from TS_RESPONSAVEL"; //alterado : removido owner "CORRMAIS" de antes do nome da tabela - esertorio - 200809241206
            List<Responsavel> responsavels = new List<Responsavel>();

            using (IDataReader rdr = TerminologiaSinacor.Presenter.DAL.Oracle.OracleHelper.executeReader(ConfigurationManager.AppSettings["ConnectionStringSinaTools"], System.Data.CommandType.Text, sql, null))
            {
                while (rdr.Read())
                {
                    Responsavel responsavel = new Responsavel();
                    responsavel.codigo = rdr["COD_RESPONSAVEL"].ToString();
                    responsavel.nome = rdr["NOME_RESPONSAVEL"].ToString();
                    responsavels.Add(responsavel);
                }
            }
            return responsavels;
        }

    }
}
